<?php 
$customerData = json_encode($model->attributes);
Yii::app()->clientScript->registerScript('Custno',"
    custno='$model->custno';
    customer = $customerData;",  CClientScript::POS_HEAD); 
Yii::app()->clientScript->registerScript('type',
        "var type=".DOCTYPE_CUST.";",  CClientScript::POS_HEAD);
Yii::app()->clientScript->registerScript('data',"            
                var locno=null;
                var dispatch=null;",CClientScript::POS_HEAD);
?>

<?php Yii::app()->clientScript->registerScriptFile(Yii::app()->baseUrl.'/js/app/customers.js',CClientScript::POS_BEGIN);?>
<?php Yii::app()->clientScript->registerScriptFile(Yii::app()->baseUrl.'/js/app/locations.js',CClientScript::POS_BEGIN);?>
<?php Yii::app()->clientScript->registerScriptFile(Yii::app()->baseUrl.'/js/app/documents.js',CClientScript::POS_BEGIN);?>
<?php Yii::app()->clientScript->registerScriptFile(Yii::app()->baseUrl.'/js/app/customerContracts.js',CClientScript::POS_BEGIN);?>
<?php Yii::app()->clientScript->registerScriptFile(Yii::app()->baseUrl.'/js/app/customerJobs.js',CClientScript::POS_BEGIN);?>
<?php Yii::app()->clientScript->registerScriptFile(Yii::app()->baseUrl.'/js/app/customerGlobalContacts.js',CClientScript::POS_BEGIN);?>
<?php Yii::app()->clientScript->registerScriptFile(Yii::app()->baseUrl . '/js/app/customerAccounting.js', CClientScript::POS_BEGIN); ?>
<?php Yii::app()->clientScript->registerScriptFile(Yii::app()->baseUrl . '/js/restrictiveFileUpload.js', CClientScript::POS_BEGIN); ?>
<?php Yii::app()->clientScript->registerScriptFile(Yii::app()->baseUrl . '/js/app/customerReport.js', CClientScript::POS_BEGIN); ?>


<div id="left-col">
    <?php $this->renderPartial('_side',array(
        'model'=>$model,
        'showCreate'=>false,
    ))?>        
</div>

<div id="right-col">

    <div class="wrap">
        <div class="container">
            
            
            
            <div class="inside">
                <?php $this->renderPartial('_view',array(
                    'customer'=>$model,
                ))?>
                <ul id="tab" class="tabs tabs-with-summary">
                    <li class='active'><a id="tabUpdate" href="#update">Info</a></li>
                    <li class=''><a id="tabLocation" href="#locations">Location</a></li>
                    <li class=''><a id="tabDocument" href="#document">Documents</a></li>
                   
                    <li><a id="tabJobs" href="#jobs">Jobs</a></li>
                    <li><a id="tabContracts" href="#contracts">Contracts</a> </li>
                                        <li><a id="tabGlobalContacts" href="#globalcontacts">Global Contacts</a> </li> 
                 <li><a id="tabAccounting" href="#accounting"> Accounting</a></li>
                </ul>
                <br/>
                <div id="update">
                    <?php $this->renderPartial('_form',array(
                        'model'=>$model,
                    ));?>
                </div>
                <div id="locations">
   <div class="form">
                    <div class ="row">
                        <label>Status</label>
                        <?php 
                        $data = array(
            
            '0'=>'Active',
            '1'=>'Inactive',
                            '-1'=>'Pending',
        );
                        echo CHtml::dropDownList('statuslc','',$data);  ?>
                    </div>
                </div>
                    <div id="location-list"></div>
                </div>
                <div id="document">
                    <div id="document-list">
                        
                    </div>
                </div>
               
                <div id="jobs">
   <div class="form">
                    <div class ="row">
                        <label>Status</label>
                        <?php echo CHtml::dropDownList('statusj', '', JobsStatus::getListData()); ?>
                    </div></div>
                    <div id="job-list"></div>
                </div>
                <div id="contracts">

<div class="form">
                    
                      <div class="row">
        <?php echo CHtml::label('Contract Report Type', 'contractType'); ?>
        <?php echo CHtml::dropDownList('contractType','',ContractType::getListData()) ?>
					</div>
					 <div class="row short">
        <?php echo CHtml::label('Contract Start Date', 'contractstartdate'); ?>
        <?php
        $this->widget('zii.widgets.jui.CJuiDatePicker', array(
            'name' => 'contractstartdate',
            'value' =>'',
            'options' => array('dateFormat' => 'yy-mm-dd'),
        ));
        ?>

    </div>
    <div class="row short">
        <?php echo CHtml::label('Contract End Date', 'contractenddate'); ?>
        <?php
        $this->widget('zii.widgets.jui.CJuiDatePicker', array(
            'name' => 'contractenddate',
            'value' =>'',
            'options' => array('dateFormat' => 'yy-mm-dd'),
        ));
        ?>

    </div>
					<div class="row">
					 <label>Actions: </label>
					<div class="model-data">
					 <a class="print-button" onclick="getPDF()";> View & Print</a>|
					  <a  class="email-button" onclick="createMailPanel()";> Email</a><br/>
					</div>
					</div>
					<div class ="row">
                        <label>Status</label>
                        <?php 
                      $criteria = new CDbCriteria();
                      $criteria->addColumnCondition(array('inactive'=>0));
                      $criteria->order = 'description ASC';
        $data = CHtml::listData(ContractStatus::model()->findAll($criteria), 'id', 'description');
                        echo CHtml::dropDownList('statuscc','',$data);  ?>
                    </div>
                </div>
                    <div id="contract-list"></div>
                </div>

   <div id="globalcontacts">
                       <a id="createGC" class="add-button">Add Global Contact </a>
                    <div id="globalcontacts-list">
                        
                    </div>
                </div>
                  <div id="accounting">

                    <div class="form">
						  <div class="row">
                        <div class="model-data">
                       <a target="_blank" href="/index.php?r=pdf/Statement&custno=<?=$model->custno?>"> 
                                View/Print A/R STATEMENT </a>
                        </div>
                        </div>
                        <div class ="row">
                            <label>Type</label>
                            <?php
                            $data = array('Received Payments',
                                             'Invoices',
                                           'Credit Memos',
					   'Job : Sales Orders'
                            );
                            echo CHtml::dropDownList('type', '', $data);
                            ?>
                         
                            
                        </div>
                      
                    </div>
                    <div id="paymentAlertText" style="display:none;">No QuickBooks account has been defined.  Please contact your system administrator for furture assistance.</div>
                    <div id="accounting-list"></div>
                    <div id="accounting-inv-list"></div>
                </div>
            </div><!-- inside -->
        </div><!-- container -->
    </div><!-- wrap -->
    <?php $this->renderPartial('/copyright'); ?>
</div> <!-- left-col -->
